/*
 * @Description: 
 * @Version: 0.0
 * @Author: taosong
 * @Date: 2023-12-11 20:22:55
 * @LastEditors: taosong
 * @LastEditTime: 2023-12-11 20:36:00
 */

// get set  属性访问器
class DateUtil {

  _age?: number

  constructor(name: string, address: string) {}

  set age(val: number) {
    if (val > 10 && val < 120) {
      this._age = val
    } else {
      throw new Error('年龄不在合适范围')
    }
  }
  get age() {
    console.log('获取到了')
    return this._age as number
  } 
}

let dateUtil = new DateUtil('wangwu', '柳条巷')
dateUtil.age = 70
dateUtil.age


export {}